import {menulist} from "../../../request/api"


//封装接口类型
interface StateMenu {
   menuList:Array<object>
}
const state ={
    menuList:[]

}

const getters ={
    getMenu(state:StateMenu){
        return state.menuList
    }
}

const mutations ={
    REQ_MENULIST(state:StateMenu,payload:any){
        state.menuList =  payload
    }

}

const actions = {
    getMenuAction(context:any){
      menulist({istree:true}).then(res=>{
        // console.log(res);
        if(res.code==200){
            context.commit("REQ_MENULIST",res.list)
        }
      })
    }

}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}
